import {getDictFindByKey, getAllDicts} from "@/api/common";
import {getAreaTree, getGzAreaNameList} from '@/api/system/area'
import vue from "@/main.js";
import store from "@/store/index";

let AreaName = []
let AreaTreeOptions = []
let GzAreaOptions = []

let ModeName = {
  "/alarm/gas": "燃气",
  "/alarm/water": "供水",
  "/alarm/drain": "排水",
  "/alarm/tunnel": "综合管廊",
  "/alarm/sanitation": "环卫",
  "/alarm/heating":"供热",

  "/alarm/build": "建筑", //需要修改
  "/alarm/elevator": "电梯",
  "/alarm/advert": "户外广告",
  "/alarm/road": "道路",  //需要修改
  "/alarm/bridge": "桥梁", //需要修改
  "/alarm/td": "塔吊",  //需要修改
  "/alarm/site": "工地",  //需要修改
  "/alarm/noise": "扬尘噪音", //需要修改

  "/alarm/rate": "人流密度",  //需要修改
  "/alarm/fireplace": "密集场所",//需要修改
  "/alarm/activity": "大型活动",//需要修改

  // 地市版本拆分使用
  "/alarmData/gas": "燃气",
  "/alarmData/water": "供水",
  "/alarmData/drain": "排水",
  "/alarmData/tunnel": "综合管廊",
  "/alarmData/sanitation": "环卫",
  "/alarmData/heating":"供热",

  "/alarmData/build": "建筑", //需要修改
  "/alarmData/elevator": "电梯",
  "/alarmData/advert": "户外广告",
  "/alarmData/road": "道路",  //需要修改
  "/alarmData/bridge": "桥梁", //需要修改
  "/alarmData/site": "工地",  //需要修改
  "/alarmData/td": "塔吊",
  "/alarmData/noise": "扬尘噪音", //需要修改

  "/alarmData/rate": "人流密度",  //需要修改
  "/alarmData/fireplace": "密集场所",//需要修改
  "/alarmData/activity": "大型活动",//需要修改
}

let AlarmPathConfig = [
  { //燃气
    "path": "/alarm/gas",
    "modeType": "ALARM_RQL",
    "alarmType": "SSLX_RQL",
    //报警类型-数据字典里的key
    "recordType": "recordTypeRQL",
    //预警数据
    "modeTypeYj": "ALARM_RQL",
    //预警类型-数据字典里的key
    "warnType": "warnTypeRQL",
    //实时数据
    "modeTypeSs": "ALARM_RQL",
    "fTitle": "燃气设施信息",
    "pTitle": "燃气监测点分布信息",
    "dTitle": "燃气设备信息",
    "rTitle": "燃气报警信息",
    "wTitle": "燃气预警信息",
    "hTitle": "燃气设备实时监测数据信息"
  },
  { //供水管网
    "path": "/alarm/water",
    "modeType": "ALARM_GSL",
    "alarmType": "SSLX_GSL",
    //报警类型-数据字典里的key
    "recordType": "recordTypeGSL",
    //预警数据
    "modeTypeYj": "ALARM_GSL",
    //预警类型
    "warnType": "warnTypeGSL",
    //实时数据
    "modeTypeSs": "ALARM_GSL",
    "fTitle": "供水设施信息",
    "pTitle": "供水监测点分布信息",
    "dTitle": "供水设备信息",
    "rTitle": "供水报警信息",
    "wTitle": "供水预警信息",
    "hTitle": "供水设备实时监测数据信息"
  },
  { //排水管网
    "path": "/alarm/drain",
    "modeType": "ALARM_PSL",
    "alarmType": "SSLX_PSL",
    //报警类型-数据字典里的key
    "recordType": "recordTypePSL",
    //预警数据
    "modeTypeYj": "ALARM_PSL",
    //预警类型-数据字典里的key
    "warnType": "warnTypePSL",
    //实时数据
    "modeTypeSs": "ALARM_PSL",
    "fTitle": "排水设施信息",
    "pTitle": "排水监测点分布信息",
    "dTitle": "排水设备信息",
    "rTitle": "排水报警信息",
    "wTitle": "排水预警信息",
    "hTitle": "排水设备实时监测数据信息"
  },
  { //综合管廊
    "path": "/alarm/tunnel",
    "modeType": "ALARM_ZHGLL",
    "alarmType": "SSLX_ZHGLL",
    //报警类型-数据字典里的key
    "recordType": "recordTypeZHGLL",
    //预警数据
    "modeTypeYj": "ALARM_ZHGLL",
    //预警类型-数据字典里的key
    "warnType": "warnTypeZHGLL",
    //实时数据
    "modeTypeSs": "ALARM_ZHGLL",
    "fTitle": "综合管廊设施信息",
    "pTitle": "综合管廊监测点分布信息",
    "dTitle": "综合管廊设备信息",
    "rTitle": "综合管廊报警信息",
    "wTitle": "综合管廊预警信息",
    "hTitle": "综合管廊设备实时监测数据信息"
  },
  { //环卫
    "path": "/alarm/sanitation",
    "modeType": "ALARM_HWL",
    "alarmType": "SSLX_HWL",
    //报警类型-数据字典里的key
    "recordType": "recordTypeHWL",
    //预警数据
    "modeTypeYj": "ALARM_HWL",
    //预警类型-数据字典里的key
    "warnType": "warnTypeHWL",
    //实时数据
    "modeTypeSs": "ALARM_HWL",
    "fTitle": "环卫设施信息",
    "pTitle": "环卫监测点分布信息",
    "dTitle": "环卫设备信息",
    "rTitle": "环卫报警信息",
    "wTitle": "环卫预警信息",
    "hTitle": "环卫设备实时监测数据信息"
  },
  { // 供热
    "path": "/alarm/heating",
    "modeType": "ALARM_GRL",
    "alarmType": "SSLX_GRL",
    //报警类型-数据字典里的key
    "recordType": "recordTypeGRL",
    //预警数据
    "modeTypeYj": "ALARM_GRL",
    //预警类型-数据字典里的key
    "warnType": "warnTypeGRL",
    //实时数据
    "modeTypeSs": "ALARM_GRL",
    "fTitle": "供热设施信息",
    "pTitle": "供热监测点分布信息",
    "dTitle": "供热设备信息",
    "rTitle": "供热报警信息",
    "wTitle": "供热预警信息",
    "hTitle": "供热设备实时监测数据信息"
  },
  { //建筑
    "path": "/alarm/build",
    "modeType": "ALARM_JZL",
    "alarmType": "SSLX_JZL",
    //报警类型-数据字典里的key
    "recordType": "recordTypeJZL",
    //预警数据
    "modeTypeYj": "ALARM_JZL",
    //预警类型-数据字典里的key
    "warnType": "warnTypeJZL",
    //实时数据
    "modeTypeSs": "ALARM_JZL",
    "fTitle": "建筑设施信息",
    "pTitle": "建筑监测点分布信息",
    "dTitle": "建筑设备信息",
    "rTitle": "建筑报警信息",
    "wTitle": "建筑预警信息",
    "wTitle1": "倾斜监测预警信息",
    "wTitle2": "沉降监测预警信息",
    "wTitle3": "裂缝监测预警信息",
    "wTitle4": "震动监测预警信息",
    "hTitle": "建筑设备实时监测数据信息"
  },
  { //电梯
    "path": "/alarm/elevator",
    "modeType": "ALARM_DTL",
    "alarmType": "SSLX_DTL",
    //报警类型-数据字典里的key
    "recordType": "recordTypeDTL",
    //预警数据
    "modeTypeYj": "ALARM_DTL",
    //预警类型-数据字典里的key
    "warnType": "warnTypeDTL",
    //实时数据
    "modeTypeSs": "ALARM_DTL",
    "fTitle": "电梯设施信息",
    "pTitle": "电梯监测点分布信息",
    "dTitle": "电梯设备信息",
    "rTitle": "电梯报警信息",
    "wTitle": "电梯预警信息",
    "hTitle": "电梯设备实时监测数据信息"
  },
  { //户外广告
    "path": "/alarm/advert",
    "modeType": "ALARM_HWGGL",
    "alarmType": "SSLX_HWGGL",
    //报警类型-数据字典里的key
    "recordType": "recordTypeHWGGL",
    //预警数据
    "modeTypeYj": "ALARM_HWGGL",
    //预警类型-数据字典里的key
    "warnType": "warnTypeHWGGL",
    //实时数据
    "modeTypeSs": "ALARM_HWGGL",
    "fTitle": "户外广告设施信息",
    "pTitle": "户外广告监测点分布信息",
    "dTitle": "户外广告设备信息",
    "rTitle": "户外广告报警信息",
    "wTitle": "户外广告预警信息",
    "hTitle": "户外广告设备实时监测数据信息"
  },
  { //道路
    "path": "/alarm/road",
    "modeType": "ALARM_DLL",
    "alarmType": "SSLX_DLL",

    //预警数据
    "modeTypeYj": "ALARM_DLL",


    //实时数据
    "modeTypeSs": "ALARM_DLL",
    "fTitle": "道路设施信息",
    "pTitle": "道路监测点分布信息",
    "dTitle": "道路设备信息",
    "rTitle": "道路报警信息",

    "wTitlebh": "道路病害预警",
    "warnTypebh": "warnTypeDLLBH",

    //报警类型-数据字典里的key
    "recordType": "recordTypeDLL",
    "rTitle1": "交通噪音报警",
    "rTitle2": "道路积水报警",
    "rTitle3": "道路超载报警",

    //预警类型-数据字典里的key-道路病害预警
    "warnType": "warnTypeDLL",
    "wTitle1": "交通噪音预警",
    "wTitle2": "道路积水预警",
    "wTitle3": "道路超载预警",

    "hTitle": "道路设备实时监测数据信息"
  },
  { //桥梁
    "path": "/alarm/bridge",
    "modeType": "ALARM_QLL",
    "alarmType": "SSLX_QLL",
    //报警类型-数据字典里的key
    "recordType": "recordTypeQLL",
    //预警数据
    "modeTypeYj": "ALARM_QLL",
    //预警类型-数据字典里的key
    "warnType": "warnTypeQLL",
    //实时数据
    "modeTypeSs": "ALARM_QLL",
    "fTitle": "桥梁设施信息",
    "pTitle": "桥梁监测点分布信息",
    "dTitle": "桥梁设备信息",
    "rTitle": "桥梁报警信息",
    "wTitle": "桥梁预警信息",
    "hTitle": "桥梁设备实时监测数据信息"
  },
  { //工地
    "path": "/alarm/site",
    //设施大类选择
    "alarmType": "SSLX_GDL",
    "modeType": "ALARM_GDL",
    //预警数据
    "modeTypeYj": "ALARM_GDL",
    //实时数据
    "modeTypeSs": "ALARM_GDL",
    //报警类型-数据字典里的key
    "recordType": "recordTypeGDL",
    //预警类型-数据字典里的key
    "warnType": "warnTypeGDL",
    "fTitle": "工地设施信息",
    "pTitle": "工地监测点分布信息",
    "dTitle": "工地设备信息",
    "rTitle": "工地报警信息",
    "wTitle": "工地预警信息",

    "wTitle1": "高支模预警信息",
    "wTitle2": "深基坑预警信息",
    "wTitle3": "盾构预警信息",
    "wTitle4": "起重机械预警信息",

    "hTitle": "工地设备实时监测数据信息"
  },
  { //塔吊
    "path": "/alarm/td",
    //设施大类选择
    "alarmType": "SSLX_GDL",
    "modeType": "ALARM_GDL",
    //预警数据
    "modeTypeYj": "ALARM_GDL",
    //实时数据
    "modeTypeSs": "ALARM_GDL",
    //报警类型-数据字典里的key
    "recordType": "recordTypeGDL",
    //预警类型-数据字典里的key
    "warnType": "warnTypeGDL",
    "fTitle": "塔吊设施信息",
    "pTitle": "塔吊监测点分布信息",
    "dTitle": "塔吊设备信息",
    "rTitle": "塔吊报警信息",
    "wTitle": "塔吊预警信息",

    "wTitle1": "高支模预警信息",
    "wTitle2": "深基坑预警信息",
    "wTitle3": "盾构预警信息",
    "wTitle4": "起重机械预警信息",

    "hTitle": "塔吊设备实时监测数据信息"
  },
  { //扬尘噪音
    "path": "/alarm/noise",
    //设施大类选择
    "alarmType": "SSLX_YCZY",
    "modeType": "ALARM_YCZY",
    //预警数据
    "modeTypeYj": "ALARM_YCZY",
    //实时数据
    "modeTypeSs": "ALARM_YCZY",
    //报警类型-数据字典里的key
    "recordType": "recordTypeYCZY",
    //预警类型-数据字典里的key
    "warnType": "warnTypeYCZY",
    "fTitle": "扬尘噪音设施信息",
    "pTitle": "扬尘噪音监测点分布信息",
    "dTitle": "扬尘噪音设备信息",
    "rTitle": "扬尘噪音报警信息",
    "wTitle": "扬尘噪音预警信息",
    "hTitle": "扬尘噪音设备实时监测数据信息"
  },
  { //人流密度
    "path": "/alarm/rate",
    //设施大类选择
    "alarmType": "SSLX_RLMDL",
    "modeType": "ALARM_RLMDL",
    //预警数据
    "modeTypeYj": "ALARM_RLMDL",
    //实时数据
    "modeTypeSs": "ALARM_RLMDL",
    //报警类型-数据字典里的key
    "recordType": "recordTypeRLMDL",
    //预警类型-数据字典里的key
    "warnType": "warnTypeRLMDL",
    "fTitle": "人流密度设施信息",
    "pTitle": "人流密度监测点分布信息",
    "dTitle": "人流密度设备信息",
    "rTitle": "人流密度报警信息",
    "wTitle": "人流密度预警信息",
    "hTitle": "人流密度设备实时监测数据信息"
  },
  { //密集场所
    "path": "/alarm/fireplace",
    //设施大类选择
    "alarmType": "SSLX_RMCSL",
    "modeType": "ALARM_RMCSL",
    //预警数据
    "modeTypeYj": "ALARM_RMCSL",
    //实时数据
    "modeTypeSs": "ALARM_RMCSL",
    //报警类型-数据字典里的key
    "recordType": "recordTypeRMCSL",
    //预警类型-数据字典里的key
    "warnType": "warnTypeRMCSL",
    "fTitle": "密集场所设施信息",
    "pTitle": "密集场所监测点分布信息",
    "dTitle": "密集场所设备信息",
    "rTitle": "密集场所报警信息",
    "wTitle": "密集场所预警信息",
    "hTitle": "密集场所设备实时监测数据信息"
  },
  { //大型活动
    "path": "/alarm/activity",
    //设施大类选择
    "alarmType": "SSLX_DXHDL",
    "modeType": "ALARM_DXHDL",
    //预警数据
    "modeTypeYj": "ALARM_DXHDL",
    //实时数据
    "modeTypeSs": "ALARM_DXHDL",
    //报警类型-数据字典里的key
    "recordType": "recordTypeDXHDL",
    //预警类型-数据字典里的key
    "warnType": "warnTypeDXHDL",
    "fTitle": "大型活动设施信息",
    "pTitle": "大型活动监测点分布信息",
    "dTitle": "大型活动设备信息",
    "rTitle": "大型活动报警信息",
    "wTitle": "大型活动预警信息",
    "hTitle": "大型活动设备实时监测数据信息"
  },
  // 地市版本拆分使用
  { //燃气
    "path": "/alarmData/gas",
    "modeType": "ALARM_RQL",
    "alarmType": "SSLX_RQL",
    //报警类型-数据字典里的key
    "recordType": "recordTypeRQL",
    //预警数据
    "modeTypeYj": "ALARM_RQL",
    //预警类型-数据字典里的key
    "warnType": "warnTypeRQL",
    //实时数据
    "modeTypeSs": "ALARM_RQL",
    "fTitle": "燃气设施信息",
    "pTitle": "燃气监测点分布信息",
    "dTitle": "燃气设备信息",
    "rTitle": "燃气报警信息",
    "wTitle": "燃气预警信息",
    "hTitle": "燃气设备实时监测数据信息"
  },
  { //供水管网
    "path": "/alarmData/water",
    "modeType": "ALARM_GSL",
    "alarmType": "SSLX_GSL",
    //报警类型-数据字典里的key
    "recordType": "recordTypeGSL",
    //预警数据
    "modeTypeYj": "ALARM_GSL",
    //预警类型
    "warnType": "warnTypeGSL",
    //实时数据
    "modeTypeSs": "ALARM_GSL",
    "fTitle": "供水设施信息",
    "pTitle": "供水监测点分布信息",
    "dTitle": "供水设备信息",
    "rTitle": "供水报警信息",
    "wTitle": "供水预警信息",
    "hTitle": "供水设备实时监测数据信息"
  },
  { //排水管网
    "path": "/alarmData/drain",
    "modeType": "ALARM_PSL",
    "alarmType": "SSLX_PSL",
    //报警类型-数据字典里的key
    "recordType": "recordTypePSL",
    //预警数据
    "modeTypeYj": "ALARM_PSL",
    //预警类型-数据字典里的key
    "warnType": "warnTypePSL",
    //实时数据
    "modeTypeSs": "ALARM_PSL",
    "fTitle": "排水设施信息",
    "pTitle": "排水监测点分布信息",
    "dTitle": "排水设备信息",
    "rTitle": "排水报警信息",
    "wTitle": "排水预警信息",
    "hTitle": "排水设备实时监测数据信息"
  },
  { //综合管廊
    "path": "/alarmData/tunnel",
    "modeType": "ALARM_ZHGLL",
    "alarmType": "SSLX_ZHGLL",
    //报警类型-数据字典里的key
    "recordType": "recordTypeZHGLL",
    //预警数据
    "modeTypeYj": "ALARM_ZHGLL",
    //预警类型-数据字典里的key
    "warnType": "warnTypeZHGLL",
    //实时数据
    "modeTypeSs": "ALARM_ZHGLL",
    "fTitle": "综合管廊设施信息",
    "pTitle": "综合管廊监测点分布信息",
    "dTitle": "综合管廊设备信息",
    "rTitle": "综合管廊报警信息",
    "wTitle": "综合管廊预警信息",
    "hTitle": "综合管廊设备实时监测数据信息"
  },
  { //环卫
    "path": "/alarmData/sanitation",
    "modeType": "ALARM_HWL",
    "alarmType": "SSLX_HWL",
    //报警类型-数据字典里的key
    "recordType": "recordTypeHWL",
    //预警数据
    "modeTypeYj": "ALARM_HWL",
    //预警类型-数据字典里的key
    "warnType": "warnTypeHWL",
    //实时数据
    "modeTypeSs": "ALARM_HWL",
    "fTitle": "环卫设施信息",
    "pTitle": "环卫监测点分布信息",
    "dTitle": "环卫设备信息",
    "rTitle": "环卫报警信息",
    "wTitle": "环卫预警信息",
    "hTitle": "环卫设备实时监测数据信息"
  },
  { // 供热
    "path": "/alarmData/heating",
    "modeType": "ALARM_GRL",
    "alarmType": "SSLX_GRL",
    //报警类型-数据字典里的key
    "recordType": "recordTypeGRL",
    //预警数据
    "modeTypeYj": "ALARM_GRL",
    //预警类型-数据字典里的key
    "warnType": "warnTypeGRL",
    //实时数据
    "modeTypeSs": "ALARM_GRL",
    "fTitle": "供热设施信息",
    "pTitle": "供热监测点分布信息",
    "dTitle": "供热设备信息",
    "rTitle": "供热报警信息",
    "wTitle": "供热预警信息",
    "hTitle": "供热设备实时监测数据信息"
  },
  { //建筑
    "path": "/alarmData/build",
    "modeType": "ALARM_JZL",
    "alarmType": "SSLX_JZL",
    //报警类型-数据字典里的key
    "recordType": "recordTypeJZL",
    //预警数据
    "modeTypeYj": "ALARM_JZL",
    //预警类型-数据字典里的key
    "warnType": "warnTypeJZL",
    //实时数据
    "modeTypeSs": "ALARM_JZL",
    "fTitle": "建筑设施信息",
    "pTitle": "建筑监测点分布信息",
    "dTitle": "建筑设备信息",
    "rTitle": "建筑报警信息",
    "wTitle": "建筑预警信息",
    "wTitle1": "倾斜监测预警信息",
    "wTitle2": "沉降监测预警信息",
    "wTitle3": "裂缝监测预警信息",
    "wTitle4": "震动监测预警信息",
    "hTitle": "建筑设备实时监测数据信息"
  },
  { //电梯
    "path": "/alarmData/elevator",
    "modeType": "ALARM_DTL",
    "alarmType": "SSLX_DTL",
    //报警类型-数据字典里的key
    "recordType": "recordTypeDTL",
    //预警数据
    "modeTypeYj": "ALARM_DTL",
    //预警类型-数据字典里的key
    "warnType": "warnTypeDTL",
    //实时数据
    "modeTypeSs": "ALARM_DTL",
    "fTitle": "电梯设施信息",
    "pTitle": "电梯监测点分布信息",
    "dTitle": "电梯设备信息",
    "rTitle": "电梯报警信息",
    "wTitle": "电梯预警信息",
    "hTitle": "电梯设备实时监测数据信息"
  },
  { //户外广告
    "path": "/alarmData/advert",
    "modeType": "ALARM_HWGGL",
    "alarmType": "SSLX_HWGGL",
    //报警类型-数据字典里的key
    "recordType": "recordTypeHWGGL",
    //预警数据
    "modeTypeYj": "ALARM_HWGGL",
    //预警类型-数据字典里的key
    "warnType": "warnTypeHWGGL",
    //实时数据
    "modeTypeSs": "ALARM_HWGGL",
    "fTitle": "户外广告设施信息",
    "pTitle": "户外广告监测点分布信息",
    "dTitle": "户外广告设备信息",
    "rTitle": "户外广告报警信息",
    "wTitle": "户外广告预警信息",
    "hTitle": "户外广告设备实时监测数据信息"
  },
  { //道路
    "path": "/alarmData/road",
    "modeType": "ALARM_DLL",
    "alarmType": "SSLX_DLL",

    //预警数据
    "modeTypeYj": "ALARM_DLL",


    //实时数据
    "modeTypeSs": "ALARM_DLL",
    "fTitle": "道路设施信息",
    "pTitle": "道路监测点分布信息",
    "dTitle": "道路设备信息",
    "rTitle": "道路报警信息",

    "wTitlebh": "道路病害预警",
    "warnTypebh": "warnTypeDLLBH",

    //报警类型-数据字典里的key
    "recordType": "recordTypeDLL",
    "rTitle1": "交通噪音报警",
    "rTitle2": "道路积水报警",
    "rTitle3": "道路超载报警",

    //预警类型-数据字典里的key-道路病害预警
    "warnType": "warnTypeDLL",
    "wTitle1": "交通噪音预警",
    "wTitle2": "道路积水预警",
    "wTitle3": "道路超载预警",

    "hTitle": "道路设备实时监测数据信息"
  },
  { //桥梁
    "path": "/alarmData/bridge",
    "modeType": "ALARM_QLL",
    "alarmType": "SSLX_QLL",
    //报警类型-数据字典里的key
    "recordType": "recordTypeQLL",
    //预警数据
    "modeTypeYj": "ALARM_QLL",
    //预警类型-数据字典里的key
    "warnType": "warnTypeQLL",
    //实时数据
    "modeTypeSs": "ALARM_QLL",
    "fTitle": "桥梁设施信息",
    "pTitle": "桥梁监测点分布信息",
    "dTitle": "桥梁设备信息",
    "rTitle": "桥梁报警信息",
    "wTitle": "桥梁预警信息",
    "hTitle": "桥梁设备实时监测数据信息"
  },
  { //工地
    "path": "/alarmData/site",
    //设施大类选择
    "alarmType": "SSLX_GDL",
    "modeType": "ALARM_GDL",
    //预警数据
    "modeTypeYj": "ALARM_GDL",
    //实时数据
    "modeTypeSs": "ALARM_GDL",
    //报警类型-数据字典里的key
    "recordType": "recordTypeGDL",
    //预警类型-数据字典里的key
    "warnType": "warnTypeGDL",
    "fTitle": "工地设施信息",
    "pTitle": "工地监测点分布信息",
    "dTitle": "工地设备信息",
    "rTitle": "工地报警信息",
    "wTitle": "工地预警信息",

    "wTitle1": "高支模预警信息",
    "wTitle2": "深基坑预警信息",
    "wTitle3": "盾构预警信息",
    "wTitle4": "起重机械预警信息",

    "hTitle": "工地设备实时监测数据信息"
  },
  { //工地
    "path": "/alarmData/td",
    //设施大类选择
    "alarmType": "SSLX_GDL",
    "modeType": "ALARM_GDL",
    //预警数据
    "modeTypeYj": "ALARM_GDL",
    //实时数据
    "modeTypeSs": "ALARM_GDL",
    //报警类型-数据字典里的key
    "recordType": "recordTypeGDL",
    //预警类型-数据字典里的key
    "warnType": "warnTypeGDL",
    "fTitle": "塔吊设施信息",
    "pTitle": "塔吊监测点分布信息",
    "dTitle": "塔吊设备信息",
    "rTitle": "塔吊报警信息",
    "wTitle": "塔吊预警信息",

    "wTitle1": "高支模预警信息",
    "wTitle2": "深基坑预警信息",
    "wTitle3": "盾构预警信息",
    "wTitle4": "起重机械预警信息",

    "hTitle": "塔吊设备实时监测数据信息"
  },
  { //扬尘噪音
    "path": "/alarmData/noise",
    //设施大类选择
    "alarmType": "SSLX_YCZY",
    "modeType": "ALARM_YCZY",
    //预警数据
    "modeTypeYj": "ALARM_YCZY",
    //实时数据
    "modeTypeSs": "ALARM_YCZY",
    //报警类型-数据字典里的key
    "recordType": "recordTypeYCZY",
    //预警类型-数据字典里的key
    "warnType": "warnTypeYCZY",
    "fTitle": "扬尘噪音设施信息",
    "pTitle": "扬尘噪音监测点分布信息",
    "dTitle": "扬尘噪音设备信息",
    "rTitle": "扬尘噪音报警信息",
    "wTitle": "扬尘噪音预警信息",
    "hTitle": "扬尘噪音设备实时监测数据信息"
  },
  { //人流密度
    "path": "/alarmData/rate",
    //设施大类选择
    "alarmType": "SSLX_RLMDL",
    "modeType": "ALARM_RLMDL",
    //预警数据
    "modeTypeYj": "ALARM_RLMDL",
    //实时数据
    "modeTypeSs": "ALARM_RLMDL",
    //报警类型-数据字典里的key
    "recordType": "recordTypeRLMDL",
    //预警类型-数据字典里的key
    "warnType": "warnTypeRLMDL",
    "fTitle": "人流密度设施信息",
    "pTitle": "人流密度监测点分布信息",
    "dTitle": "人流密度设备信息",
    "rTitle": "人流密度报警信息",
    "wTitle": "人流密度预警信息",
    "hTitle": "人流密度设备实时监测数据信息"
  },
  { //密集场所
    "path": "/alarmData/fireplace",
    //设施大类选择
    "alarmType": "SSLX_RMCSL",
    "modeType": "ALARM_RMCSL",
    //预警数据
    "modeTypeYj": "ALARM_RMCSL",
    //实时数据
    "modeTypeSs": "ALARM_RMCSL",
    //报警类型-数据字典里的key
    "recordType": "recordTypeRMCSL",
    //预警类型-数据字典里的key
    "warnType": "warnTypeRMCSL",
    "fTitle": "密集场所设施信息",
    "pTitle": "密集场所监测点分布信息",
    "dTitle": "密集场所设备信息",
    "rTitle": "密集场所报警信息",
    "wTitle": "密集场所预警信息",
    "hTitle": "密集场所设备实时监测数据信息"
  },
  { //大型活动
    "path": "/alarmData/activity",
    //设施大类选择
    "alarmType": "SSLX_DXHDL",
    "modeType": "ALARM_DXHDL",
    //预警数据
    "modeTypeYj": "ALARM_DXHDL",
    //实时数据
    "modeTypeSs": "ALARM_DXHDL",
    //报警类型-数据字典里的key
    "recordType": "recordTypeDXHDL",
    //预警类型-数据字典里的key
    "warnType": "warnTypeDXHDL",
    "fTitle": "大型活动设施信息",
    "pTitle": "大型活动监测点分布信息",
    "dTitle": "大型活动设备信息",
    "rTitle": "大型活动报警信息",
    "wTitle": "大型活动预警信息",
    "hTitle": "大型活动设备实时监测数据信息"
  }
]


export default {
  //监测预警模块参数配置
  getModeName(path) {
    // 过滤字符（省+地市）
    path = path.replace("/jcfx", "")
    path = path.replace("/dsjcfx","")
    path = path.replace("/gdsbxx","") //工地设备信息
    path = path.replace("/gdsbjc","") //工地设备监测
    path = path.replace("/bjgl","") //工地设备报警管理
    path = path.replace("/facility", "")
    path = path.replace("/point", "")
    path = path.replace("/device", "")
    path = path.replace("/history", "")
    path = path.replace("/record", "")
    return ModeName[path]
  },
  getAlarmPathConfig(path) {
    console.log(path)
    // 过滤字符（省+地市）
    path = path.replace("/jcfx", "")
    path = path.replace("/dsjcfx","")
    path = path.replace("/gdsbxx","")//工地设备信息
    path = path.replace("/gdsbjc","")//工地设备监测
    path = path.replace("/bjgl","") //工地设备报警管理
    path = path.replace("/facility", "")
    path = path.replace("/point", "")
    path = path.replace("/device", "")
    path = path.replace("/history", "")
    path = path.replace("/record", "")
    let config = AlarmPathConfig.find(t => t.path == path)
    return config;
  },

  // 查询指定数据字典
  getSystemParams(paraKey, paraArr) {
    return new Promise(function (resolve, reject) {
      getDictFindByKey(paraKey).then(res => {
        // console.log('system字典===',res.data)
        let data = res.data.dictDataList;
        for (let s of data) {
          let innerObj = {
            label: s.dictLabel,
            name: s.dictValue,
            value: Number(s.dictValue),
            valueText: s.dictValue
          };
          paraArr.push(innerObj);
        }
        resolve(paraArr);
      });
    });
  },

  // 查询所有数据字典并缓存起来
  getAllDataDictionary() {
    const that = this;
    getAllDicts().then(res => {
      console.log("获取所有数据字典===", res, store);
      let data = res.data;
      store.commit("account/setAllDataDict", data);
    });
    this.getGzAreaListNameData()
  },

  // 过滤指定数据字典
  filterDataDict(dictType, paraArr) {
    let allDataDict = vue.$store.state.account.allDataDict;
    // console.log('filterDataDict',vue.$store.state.account.allDataDict)
    let dataObj = allDataDict.find(item => item.dictType == dictType);
    let list = dataObj.dictDataList;
    // console.log('dataObj',dataObj)
    for (let s of list) {
      let innerObj = {
        label: s.dictLabel,
        name: s.dictValue,
        value: Number(s.dictValue),
        valueText: s.dictValue
      };
      paraArr.push(innerObj);
    }
    return paraArr;
  },
  /**
   * 根据区域代码获取区域名称
   * @param {*} row {provinceCode: "110000", cityCode: "110100", countyCode: "110101"}
   * @returns
   */
  areaCodeToName(row) {
    let areaTreeList = []
    return new Promise((resolve, reject) => {
      function getAreaTreeList(val) {
        if (!val.children) {
          return
        }
        val.children.forEach(t => {
          areaTreeList.push(t)
          getAreaTreeList(t)
        })
      }

      // console.log(AreaTreeOptions,this.$store.state)
      if (AreaTreeOptions.length > 0) {
        nameFind(row)
        return
      }
      getAreaTree({parentCode: "440000000000"}).then(res => {
        if (res.code == 200) {
          AreaTreeOptions = res.data
          // console.log('AreaTreeOptions',AreaTreeOptions)
          nameFind(row)
        } else {
          reject()
        }
      })

      function nameFind(row) {
        AreaTreeOptions.forEach(t => {
          areaTreeList.push(t)
          getAreaTreeList(t)
        })
        let province = areaTreeList.find(t => t.value == row.provinceCode)
        let city = areaTreeList.find(t => t.value == row.cityCode)
        let county = areaTreeList.find(t => t.value == row.countyCode)
        let temp = []
        if (province) {
          temp.push(province.label)
        }
        if (city) {
          temp.push(city.label)
        }
        if (county) {
          temp.push(county.label)
        }
        AreaName = temp.join("")
        // console.log('AreaName',AreaName)
        resolve(AreaName)
      }
    })
  },
  getGzAreaListNameData() {
    console.log('加载广州城市名称')
    return new Promise((resolve, reject) => {
      getGzAreaNameList({parentCode: "440000000000"}).then(res => {
        if (res.code == 200) {
          GzAreaOptions = res.data
          console.log('加载广州城市名称ok')
        } else {
          reject()
        }
      })
    })
  },
  getGzAreaName(provinceCode, cityCode, countyCode) {
    return new Promise((resolve, reject) => {
      if (GzAreaOptions.length != 0) {
        resolve(this.showGzAreaName(provinceCode, cityCode, countyCode));
      } else {
        getGzAreaNameList({parentCode: "440000000000"}).then(res => {
          if (res.code == 200) {
            GzAreaOptions = res.data
            console.log('重新加载广州城市名称ok')
            resolve(this.showGzAreaName(provinceCode, cityCode, countyCode));
          } else {
            reject()
          }
        })
      }
    })
  },
  showGzAreaName(provinceCode, cityCode, countyCode) {
    let pitem = GzAreaOptions.find(t => t.areaCode == provinceCode)
    let provinceName = '';
    if (pitem) {
      provinceName = pitem.areaName
    }
    let pcitem = GzAreaOptions.find(t => t.areaCode == cityCode)
    let cityName = '';
    if (pcitem) {
      cityName = pcitem.areaName
    }
    let pccitem = GzAreaOptions.find(t => t.areaCode == countyCode)
    let countyName = '';
    if (pccitem) {
      countyName = pccitem.areaName
    }
    //console.log('222222222-----' + provinceName + cityName + countyName)
    return provinceName + cityName + countyName;
  },

  getPlaceType(deptIds){
    // 空值 或 2位默认省
    if(deptIds==null || deptIds.length==2){
       return "02"
    }else if(deptIds.length==4){
      // 判断中山、东莞 为04
      if(deptIds == '4420' || deptIds =='4419'){
        return '04'
      }
      return "03"
    }else{
      // 判断中山 为04
      if(deptIds == '442'){
        return '04'
      }
      return "02"
    }
  },

  /**
   * 是否显示督办按钮
   * @param handedStatus
   * @param type
   * @returns {boolean}
   */
  showUrgeButton(handedStatus,type){
    // 【处理状态】handedStatus： 1处理中 2处理完结 ''未处理
    // 【类型】type：alarm 报警 warning预警
     if(handedStatus!=2){
       return true
     }
     return false
  },
  /**
    * 按屏幕宽度调整字体大小，模拟rem效果
    * 主要在echarts设置里使用，因为echarts一些选项不支持rem
   */
  adjustSize(res, type='width') {
    let docEl = document.documentElement,
      clientWidth = window.innerWidth ||
      document.documentElement.clientWidth ||
      document.body.clientWidth;
    if (!clientWidth) return;
    let adjustSize= (clientWidth / 1920);
    return res * adjustSize;
  },
  /**
    * 隐藏左侧菜单栏
   */
  setLeftMenuHidden(vue_this){
    console.log('vue_this.$route.query=====',vue_this.$route.query)
    if(vue_this.$route.query.leftMenuHidden=='1'){
      vue_this.$store.commit("setting/setMenuHidden", true);
    }
  },

  // 隐患列表细类或者三级列表列表(遍历大类找到对应细类信息)
  getRiskHazardLabelName(pVal, val, list){
    if (pVal && val && list.length != 0) {
      let item = list.find(t => t.code == pVal)
      if (undefined != item) {
        let childList = JSON.parse(item.val)
        let childItem = childList.find(t => t.code == val)
        if (undefined != childItem) {
          return childItem.label
        }
      }
    }
    return val
  },


};
